<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'result.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="assets/ico/biologo.ico" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-popover.js"></script>
<script type="text/javascript" src="js/bootstrap-scrollspy.js"></script>

<style type="text/css">
body {
	background-image: url("");
	font-family: 方正静蕾简体;
}

#diseasesForAdvence {
	
	position: absolute;
	top:20px;
	width: 700px;
	margin-top: 290px;
	margin-left: 360px;
}

form {
	font-size: 16px;
}

#titlediv {
	margin-bottom: 0px;
}

.content {
	padding-left: 18px;
	background-color: #E8F5F7;
}

.add-on {
	font-size: 14px;
}

.form-actions {
	margin-right: 52%;
}

.scrollspy-example {
	height: 200px;
	overflow: auto;
	position: relative;
}
</style>
</head>
<body>
	<%@ include file="main.jsp"%>
	<div id="diseasesForAdvence">
		<form action="exportDiseaseList.action">
			<s:iterator var="entryMap" value="#request.map" status="st0">
				<%--隱藏的disease的主鍵 --%>
				<input class="hiddenSn" type="hidden"
					value="<s:property value='#entryMap.key.sn' />" />
				<div id="accordion2" class="accordion">
					<%--每個疾病對應的複選框 --%>
					<input type="checkbox" name="checkDisease"
						id="checkDisease<s:property value='#entryMap.key.sn' />"
						value="<s:property value='#entryMap.key.sn' />" />


					<%--疾病名對應的鏈接進行的跳轉 --%>
					<i class="icon-list"></i> <a class="accordion-toggle"
						href="searchResultPage.action?sn=<s:property value='#entryMap.key.sn'/>">
						<s:property value="#entryMap.key.name"/> </a>
				</div>
			</s:iterator>
		</form>
		<%--------------------------------------------------------------------------------------------------------- --%>
		<c:if test="${not empty totalcount}">
			<span style="color: #999">找到相关的结果${totalcount}条,${maxPage}页,搜索共耗时：${time}秒</span>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
				style="cursor: pointer;" id="exportDiseaseList">导出列表</a>
		</c:if>
		<div class="pagination">
			<ul>
				<li><a id="firstpage" rel="0" href="javascript:void(0)">首页</a>
				</li>
				<li><a id="before" href="javascript:void(0)">上一页</a></li>
				<c:forEach var="pagenum" items="${pagenum}">
					<li><a class="pagenum" rel="${pagenum}"
						href="javascript:void(0)">${pagenum}</a>
					</li>
				</c:forEach>
				<li><a id="next" href="javascript:void(0)">下一页</a></li>
				<li><a id="lastpage" rel="${maxPage-1}"
					href="javascript:void(0)">尾页</a></li>
			</ul>
		</div>
		<%--分页的隐藏域 --%>
		<input id="nowpage" type="hidden" style="display:none"
			value="${nowPage} " /> <input id="hiddensearchname" type="hidden"
			style="display:none" value="${searchname}" />
	</div>


</body>
<script type="text/javascript" charset="gbk">
$(function() {
	$("#quickSearch").click(function(){
		$("#diseasesForAdvence").css("display","none");
	});
	$("#searchSampleInfo").click(function(){
		$("#diseasesForAdvence").css("display","none");
	});
	$("#advancedSearch").click(function(){
		$("#diseasesForAdvence").css("display","block");
	});
	
	
	$("#exportDiseaseList").click(function() {
		$("form").submit();
	});
});
$(function(){
	$("#quickSearch").parent().removeClass();
	$("#searchSampleInfo").parent().removeClass();
	$("#advancedSearch").parent().addClass("active");
	
	
	$("#profileQuick").removeClass("active in");
	$("#profileOrder").removeClass("active in");
	$("#profileAdvence").addClass("active in");
	
});
$(function() {
	$("#advancedSearch").click(function() {
		$("#diseases").hide();
		$.post("anvencedsearch.action");
	});
	$("#before").click(
			function() {
				var nowP = parseInt($("#nowpage").val());
				if (nowP == 0) {
					return false;
				}
				nowP = nowP - 1;
				if (nowP < 0) {
					nowP = 0;
				}
				window.location.href = "quickSearch.action?nowPage=" + nowP + "&searchname=" + $("#hiddensearchname").val();
			});
	$("#next").click(
			function() {
				var nextP = parseInt($("#nowpage").val());
				if (nextP == $("#lastpage").attr("rel")) {
					return false;
				}
				var m = parseInt($("#lastpage").attr("rel"));
				nextP = nextP + 1;
				if (nextP > m) {
					nextP = m;
				}
				window.location.href = "quickSearch.action?nowPage="
						+ nextP + "&searchname="
						+ $("#hiddensearchname").val();
			});

	$(".pagenum").click(
			function() {
				var page = $(this).attr("rel");
				if (parseInt(page) == (parseInt($("#nowpage").val()) + 1)) {
					return false;
				}
				window.location.href = "quickSearch.action?nowPage="
						+ (parseInt(page) - 1) + "&searchname="
						+ $("#hiddensearchname").val();
			});

	$("#firstpage").click(
			function() {
				if (parseInt($("#nowpage").val()) == ($("#firstpage")
						.attr("rel"))) {
					return false;
				}
				window.location.href = "quickSearch.action?nowPage="
						+ $("#firstpage").attr("rel") + "&searchname="
						+ $("#hiddensearchname").val();
				$("#firstpage").parent().addClass("active");
			});
	$("#lastpage").click(
			function() {
				if (parseInt($("#nowpage").val()) == ($("#lastpage")
						.attr("rel"))) {
					return false;
				}
				$("#hiddensearchname").val();
				window.location.href = "quickSearch.action?nowPage="
						+ $("#lastpage").attr("rel") + "&searchname="
						+ $("#hiddensearchname").val();
			});
});
$(function() {
	$(".btn-danger").click(function() {
		$(".well").popover("show");
	});
	$(".disease_type").click(
			function() {
				$.post("disease_type.action", {
					"sn" : $(this).attr("rel")
				}, function(data) {
					$("#diseaseTypevalue" + data.diseaseCategory.sn)
							.toggle();
					$("#diseaseTypevalueSub" + data.diseaseCategory.sn)
							.text(data.diseaseCategory.name);
				});
			});
});
</script>
</html>
